package ge.telasi.tasks.ui.search;

import java.awt.BorderLayout;
import javax.swing.JCheckBox;
import javax.swing.JPanel;

/**
 * Date search.
 *
 * @author dimitri
 */
public class BooleanSearch extends JPanel implements FieldEditor<BooleanField> {
    private BooleanField proto;
    private JCheckBox check;

    public BooleanSearch() {
        initComponents();
    }

    private void initComponents() {
        setLayout(new BorderLayout(5, 5));
        check = new JCheckBox();
        add(check, BorderLayout.WEST);
    }

    public BooleanField getField() {
        BooleanField field = new BooleanField(proto.getName(), proto.getHumanName());
        field.setFlag(check.isSelected());
        return field;
    }

    public void setField(BooleanField field) {
        this.proto = field;
    }

}
